function clean_figure(varargin)
%
% make figure "clean" for better graphing.
% The following things are done:
% The line widths for all axes are set to 1.2
% The "box" is turned OFF for all axes.
% The font size is set to be bigger pt.
% 11/3/03 P. Manis
% if the arg is 1, the axes boxes are all SQUARE
% 

deflinewidth = 1.5;
defaxesline = 1.2;
defsymbolsize = 4;
labelfontsize = 14;
axisfontsize = 16;
titlefontsize = 22;

if(nargin == 0)
   arg = 0;
else
   arg = varargin{1};
end;


hf = gcf;
hc = get(hf, 'Children');
for i = 1:length(hc)
   hc2 = get(hc(i), 'children');
   for j = 1:length(hc2)
      if(strcmp(get(hc2(j), 'type'), 'line'))
         set(hc2(j), 'LineWidth', deflinewidth);   
      if(~isempty(get(hc2(j), 'marker')))
         set(hc2(j), 'markersize', defsymbolsize);
      end;
   end;
   
   end;
   if(strcmp(get(hc(i), 'Type'), 'axes'))
      set(hc(i), 'LineWidth', defaxesline);
      set(hc(i), 'Fontsize', labelfontsize, 'FontUnits', 'points', 'FontName', 'Helvetica', 'FontWeight', 'Normal');
      set(hc(i), 'tickdir', 'out', 'ticklength', [0.01 0.01]);
      set(hc(i), 'box', 'off');
      hx = get(hc(i), 'Xlabel');
      if(~isempty(hx))
	      set(hx, 'Fontsize', axisfontsize, 'FontUnits', 'points', 'FontName', 'Helvetica', 'FontWeight', 'bold');
		end;         
      hy = get(hc(i), 'Ylabel');
      if(~isempty(hy))
	      set(hy, 'Fontsize', axisfontsize, 'FontUnits', 'points', 'FontName', 'Helvetica', 'FontWeight', 'bold');
		end;         
      if(arg == 1)
         set(hf, 'currentaxes', hc(i));
	      axis square
      end;
   if(~isempty(get(hc(i), 'title')))
         set(get(hc(i), 'title'), 'Fontsize', titlefontsize, 'FontUnits', 'points', 'FontName', 'Helvetica', 'FontWeight', 'Bold');
   end;
   end;

end;

